<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>welcome</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/materialdesignicons.min.css}" rel="stylesheet">
    <link th:href="@{/css/style.min.css}" rel="stylesheet">
</head>
<body>

<div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body">
                        <form method="post" th:action="@{/updateTel}" class="site-form" onsubmit="return check()">
                            <div class="form-group">
                                <label for="tel">新手机号</label>
                                <input type="tel" class="form-control" name="tel" id="tel" placeholder="输入新的手机号">
                            </div>
                            <div class="form-group">
                                <label for="confirm-tel">确认新手机号</label>
                                <input type="tel" class="form-control" name="tel2" id="confirm-tel" placeholder="再次输入新的手机号">
                            </div>
                            <button type="submit" class="btn btn-primary">确认修改</button>
                        </form>
                        <hr/>
                        <div class="layui-bg-gray">
                            <p style="font-size: 30px">[[${updatetelmsg}]]</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/js/perfect-scrollbar.min.js}"></script>
<script type="text/javascript" th:src="@{/js/main.min.js}"></script>
<script type="text/javascript">
    function check(){
        if ([[${session.user.is_cold}]] == 1){
            alert("您的账号已冻结！无法进行此操作。");
            return false;
        }
        var tel = document.getElementsByName("tel")[0].value;
        var tel2 = document.getElementsByName("tel2")[0].value;

        if (tel != tel2){
            alert("输入不一致");
            return false;
        }
        if (tel.length!=11 || tel2.length!=11){
            alert("请输入正确的手机号");
            return false;
        }
        return true;
    }
</script>
</html>